<span class='l l-1 source perl'><s class='keyword control perl' data-entity-scope='keyword.control.perl'>use</s> strict;
</span><span class='l l-2 source perl'>
</span><span class='l l-3 source perl'><s class='meta comment full-line perl' data-entity-scope='meta.comment.full-line.perl'><s class='comment line number-sign perl' data-entity-scope='comment.line.number-sign.perl'><s class='punctuation definition comment perl' data-entity-scope='punctuation.definition.comment.perl'>#</s>
</s></s></span><span class='l l-4 source perl'><s class='meta comment full-line perl' data-entity-scope='meta.comment.full-line.perl'><s class='comment line number-sign perl' data-entity-scope='comment.line.number-sign.perl'><s class='punctuation definition comment perl' data-entity-scope='punctuation.definition.comment.perl'>#</s> This script also prints the contents of all the listed files, but
</s></s></span><span class='l l-5 source perl'><s class='meta comment full-line perl' data-entity-scope='meta.comment.full-line.perl'><s class='comment line number-sign perl' data-entity-scope='comment.line.number-sign.perl'><s class='punctuation definition comment perl' data-entity-scope='punctuation.definition.comment.perl'>#</s> it first scans through the list to check that each file exists and
</s></s></span><span class='l l-6 source perl'><s class='meta comment full-line perl' data-entity-scope='meta.comment.full-line.perl'><s class='comment line number-sign perl' data-entity-scope='comment.line.number-sign.perl'><s class='punctuation definition comment perl' data-entity-scope='punctuation.definition.comment.perl'>#</s> is readable.  It will stop if there are any errors.
</s></s></span><span class='l l-7 source perl'><s class='meta comment full-line perl' data-entity-scope='meta.comment.full-line.perl'><s class='comment line number-sign perl' data-entity-scope='comment.line.number-sign.perl'><s class='punctuation definition comment perl' data-entity-scope='punctuation.definition.comment.perl'>#</s>
</s></s></span><span class='l l-8 source perl'>
</span><span class='l l-9 source perl'><s class='storage modifier perl' data-entity-scope='storage.modifier.perl'>my</s> <s class='variable other readwrite global perl' data-entity-scope='variable.other.readwrite.global.perl'><s class='punctuation definition variable perl' data-entity-scope='punctuation.definition.variable.perl'>$</s>bad</s> = 0;
</span><span class='l l-10 source perl'><s class='keyword control perl' data-entity-scope='keyword.control.perl'>foreach</s> <s class='storage modifier perl' data-entity-scope='storage.modifier.perl'>my</s> <s class='variable other readwrite global perl' data-entity-scope='variable.other.readwrite.global.perl'><s class='punctuation definition variable perl' data-entity-scope='punctuation.definition.variable.perl'>$</s>fn</s> (<s class='variable other readwrite global perl' data-entity-scope='variable.other.readwrite.global.perl'><s class='punctuation definition variable perl' data-entity-scope='punctuation.definition.variable.perl'>@</s>ARGV</s>) {
</span><span class='l l-11 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s></s><s class='keyword control perl' data-entity-scope='keyword.control.perl'>if</s>(! <s class='keyword operator filetest perl' data-entity-scope='keyword.operator.filetest.perl'>-r</s> <s class='variable other readwrite global perl' data-entity-scope='variable.other.readwrite.global.perl'><s class='punctuation definition variable perl' data-entity-scope='punctuation.definition.variable.perl'>$</s>fn</s>) {
</span><span class='l l-12 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s><s class='meta even-tab' data-entity-scope='meta.even-tab'>    </s></s><s class='comment line number-sign perl' data-entity-scope='comment.line.number-sign.perl'><s class='punctuation definition comment perl' data-entity-scope='punctuation.definition.comment.perl'>#</s> File cannot be read.  See if it exists or not for a better
</s></span><span class='l l-13 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s><s class='meta even-tab' data-entity-scope='meta.even-tab'>    </s></s><s class='comment line number-sign perl' data-entity-scope='comment.line.number-sign.perl'><s class='punctuation definition comment perl' data-entity-scope='punctuation.definition.comment.perl'>#</s> error message.
</s></span><span class='l l-14 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s><s class='meta even-tab' data-entity-scope='meta.even-tab'>    </s></s><s class='keyword control perl' data-entity-scope='keyword.control.perl'>if</s>(<s class='keyword operator filetest perl' data-entity-scope='keyword.operator.filetest.perl'>-e</s> <s class='variable other readwrite global perl' data-entity-scope='variable.other.readwrite.global.perl'><s class='punctuation definition variable perl' data-entity-scope='punctuation.definition.variable.perl'>$</s>fn</s>) {
</span><span class='l l-15 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s><s class='meta even-tab' data-entity-scope='meta.even-tab'>    </s><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s></s><s class='support function perl' data-entity-scope='support.function.perl'>print</s> <s class='support function perl' data-entity-scope='support.function.perl'>STDERR</s> <s class='string quoted double perl' data-entity-scope='string.quoted.double.perl'><s class='punctuation definition string begin perl' data-entity-scope='punctuation.definition.string.begin.perl'>&quot;</s>You do not have permission to read <s class='variable other readwrite global perl' data-entity-scope='variable.other.readwrite.global.perl'><s class='punctuation definition variable perl' data-entity-scope='punctuation.definition.variable.perl'>$</s>fn</s>.<s class='constant character escape perl' data-entity-scope='constant.character.escape.perl'>\n</s><s class='punctuation definition string end perl' data-entity-scope='punctuation.definition.string.end.perl'>&quot;</s></s>;
</span><span class='l l-16 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s><s class='meta even-tab' data-entity-scope='meta.even-tab'>    </s></s>} <s class='keyword control perl' data-entity-scope='keyword.control.perl'>else</s> {
</span><span class='l l-17 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s><s class='meta even-tab' data-entity-scope='meta.even-tab'>    </s><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s></s><s class='support function perl' data-entity-scope='support.function.perl'>print</s> <s class='support function perl' data-entity-scope='support.function.perl'>STDERR</s> <s class='string quoted double perl' data-entity-scope='string.quoted.double.perl'><s class='punctuation definition string begin perl' data-entity-scope='punctuation.definition.string.begin.perl'>&quot;</s>File <s class='variable other readwrite global perl' data-entity-scope='variable.other.readwrite.global.perl'><s class='punctuation definition variable perl' data-entity-scope='punctuation.definition.variable.perl'>$</s>fn</s> does not exist.<s class='constant character escape perl' data-entity-scope='constant.character.escape.perl'>\n</s><s class='punctuation definition string end perl' data-entity-scope='punctuation.definition.string.end.perl'>&quot;</s></s>;
</span><span class='l l-18 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s><s class='meta even-tab' data-entity-scope='meta.even-tab'>    </s></s>}
</span><span class='l l-19 source perl'>
</span><span class='l l-20 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s><s class='meta even-tab' data-entity-scope='meta.even-tab'>    </s></s><s class='comment line number-sign perl' data-entity-scope='comment.line.number-sign.perl'><s class='punctuation definition comment perl' data-entity-scope='punctuation.definition.comment.perl'>#</s> One way or the other, it&#39;s bad.
</s></span><span class='l l-21 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s><s class='meta even-tab' data-entity-scope='meta.even-tab'>    </s></s><s class='variable other readwrite global perl' data-entity-scope='variable.other.readwrite.global.perl'><s class='punctuation definition variable perl' data-entity-scope='punctuation.definition.variable.perl'>$</s>bad</s> = 1;
</span><span class='l l-22 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s></s>}
</span><span class='l l-23 source perl'>}
</span><span class='l l-24 source perl'>
</span><span class='l l-25 source perl'><s class='meta comment full-line perl' data-entity-scope='meta.comment.full-line.perl'><s class='comment line number-sign perl' data-entity-scope='comment.line.number-sign.perl'><s class='punctuation definition comment perl' data-entity-scope='punctuation.definition.comment.perl'>#</s> If there was a problem, bail out.
</s></s></span><span class='l l-26 source perl'><s class='keyword control perl' data-entity-scope='keyword.control.perl'>if</s>(<s class='variable other readwrite global perl' data-entity-scope='variable.other.readwrite.global.perl'><s class='punctuation definition variable perl' data-entity-scope='punctuation.definition.variable.perl'>$</s>bad</s>) { <s class='keyword control perl' data-entity-scope='keyword.control.perl'>exit</s> 2; }
</span><span class='l l-27 source perl'>
</span><span class='l l-28 source perl'><s class='meta comment full-line perl' data-entity-scope='meta.comment.full-line.perl'><s class='comment line number-sign perl' data-entity-scope='comment.line.number-sign.perl'><s class='punctuation definition comment perl' data-entity-scope='punctuation.definition.comment.perl'>#</s> Copy all the files.
</s></s></span><span class='l l-29 source perl'><s class='keyword control perl' data-entity-scope='keyword.control.perl'>while</s>(<s class='storage modifier perl' data-entity-scope='storage.modifier.perl'>my</s> <s class='variable other readwrite global perl' data-entity-scope='variable.other.readwrite.global.perl'><s class='punctuation definition variable perl' data-entity-scope='punctuation.definition.variable.perl'>$</s>fn</s> = <s class='support function perl' data-entity-scope='support.function.perl'>shift</s> <s class='variable other readwrite global perl' data-entity-scope='variable.other.readwrite.global.perl'><s class='punctuation definition variable perl' data-entity-scope='punctuation.definition.variable.perl'>@</s>ARGV</s>) {
</span><span class='l l-30 source perl'>
</span><span class='l l-31 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s></s><s class='comment line number-sign perl' data-entity-scope='comment.line.number-sign.perl'><s class='punctuation definition comment perl' data-entity-scope='punctuation.definition.comment.perl'>#</s> Open the file.
</s></span><span class='l l-32 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s></s><s class='keyword control perl' data-entity-scope='keyword.control.perl'>if</s>(!<s class='support function perl' data-entity-scope='support.function.perl'>open</s>(INFILE, <s class='variable other readwrite global perl' data-entity-scope='variable.other.readwrite.global.perl'><s class='punctuation definition variable perl' data-entity-scope='punctuation.definition.variable.perl'>$</s>fn</s>)) {
</span><span class='l l-33 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s><s class='meta even-tab' data-entity-scope='meta.even-tab'>    </s></s><s class='comment line number-sign perl' data-entity-scope='comment.line.number-sign.perl'><s class='punctuation definition comment perl' data-entity-scope='punctuation.definition.comment.perl'>#</s> We know the file is readable, but sometimes something else goes
</s></span><span class='l l-34 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s><s class='meta even-tab' data-entity-scope='meta.even-tab'>    </s></s><s class='comment line number-sign perl' data-entity-scope='comment.line.number-sign.perl'><s class='punctuation definition comment perl' data-entity-scope='punctuation.definition.comment.perl'>#</s> wrong.  It&#39;s safer to check.
</s></span><span class='l l-35 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s><s class='meta even-tab' data-entity-scope='meta.even-tab'>    </s></s><s class='support function perl' data-entity-scope='support.function.perl'>print</s> <s class='support function perl' data-entity-scope='support.function.perl'>STDERR</s> <s class='string quoted double perl' data-entity-scope='string.quoted.double.perl'><s class='punctuation definition string begin perl' data-entity-scope='punctuation.definition.string.begin.perl'>&quot;</s>Cannot open <s class='variable other readwrite global perl' data-entity-scope='variable.other.readwrite.global.perl'><s class='punctuation definition variable perl' data-entity-scope='punctuation.definition.variable.perl'>$</s>fn</s>: <s class='variable other predefined perl' data-entity-scope='variable.other.predefined.perl'><s class='punctuation definition variable perl' data-entity-scope='punctuation.definition.variable.perl'>$</s>!</s><s class='constant character escape perl' data-entity-scope='constant.character.escape.perl'>\n</s><s class='punctuation definition string end perl' data-entity-scope='punctuation.definition.string.end.perl'>&quot;</s></s>;
</span><span class='l l-36 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s><s class='meta even-tab' data-entity-scope='meta.even-tab'>    </s></s><s class='keyword control perl' data-entity-scope='keyword.control.perl'>next</s>;
</span><span class='l l-37 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s></s>}
</span><span class='l l-38 source perl'>
</span><span class='l l-39 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s></s><s class='comment line number-sign perl' data-entity-scope='comment.line.number-sign.perl'><s class='punctuation definition comment perl' data-entity-scope='punctuation.definition.comment.perl'>#</s> Copy it.
</s></span><span class='l l-40 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s></s><s class='keyword control perl' data-entity-scope='keyword.control.perl'>while</s>(<s class='storage modifier perl' data-entity-scope='storage.modifier.perl'>my</s> <s class='variable other readwrite global perl' data-entity-scope='variable.other.readwrite.global.perl'><s class='punctuation definition variable perl' data-entity-scope='punctuation.definition.variable.perl'>$</s>l</s> = &lt;INFILE&gt;) {
</span><span class='l l-41 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s><s class='meta even-tab' data-entity-scope='meta.even-tab'>    </s></s><s class='support function perl' data-entity-scope='support.function.perl'>print</s> <s class='variable other readwrite global perl' data-entity-scope='variable.other.readwrite.global.perl'><s class='punctuation definition variable perl' data-entity-scope='punctuation.definition.variable.perl'>$</s>l</s>;
</span><span class='l l-42 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s></s>}
</span><span class='l l-43 source perl'>
</span><span class='l l-44 source perl'><s class='meta leading-tabs' data-entity-scope='meta.leading-tabs'><s class='meta odd-tab' data-entity-scope='meta.odd-tab'>    </s></s><s class='support function perl' data-entity-scope='support.function.perl'>close</s> INFILE;
</span><span class='l l-45 source perl'>}</span>
